package com.itheima.day11.meFile.test4;

import java.io.File;

public class Test {
    public static void main(String[] args) {
//        boolean isDirectory()	判断是否是文件夹
//        boolean isFile()		判断是否是文件
        // method1();
        // method2();

//        boolean exists()		判断文件是否存在
        // method3();

//        String getName()		获取文件或文件夹的名称
        // method4();


    }

    private static void method4() {
        File file = new File("D:\\aheima\\JavaSE加强\\aaa\\ddd");
        String name = file.getName();
        System.out.println(name);
    }

    private static void method3() {
        File file = new File("t");
        boolean result = file.exists();
        System.out.println(result);
    }

    private static void method2() {
        File file = new File("D:\\aheima\\JavaSE加强\\aaa\\ttt.txt");
        boolean result1 = file.isDirectory();
        boolean result2 = file.isFile();
        System.out.println(result1); // false
        System.out.println(result2); // true
    }

    private static void method1() {
        File file = new File("D:\\aheima\\JavaSE加强\\aaa\\bbb");
        boolean result1 = file.isDirectory();
        boolean result2 = file.isFile();
        System.out.println(result1); // true
        System.out.println(result2); // false
    }
}
